import { useEffect } from 'react';

export function useWindowClick(callback: (e: MouseEvent) => void): void {
  useEffect(() => {
    window.addEventListener('click', callback);
    return () => window.removeEventListener('click', callback);
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);
}
